<?php

class Model_DbTable_User extends Zend_Db_Table_Abstract
{
		protected $_name = "user";
		
		
		function getUserInfo($uid = null){
			if(!is_null($uid)){
				$select = $this->select()->setIntegrityCheck(false);;
				
				$select->from(array('u' => 'user'), 'username')
						->joinLeft(array('ut' => 'usertype'),'u.usertype = ut.id', array('userGroup' => 'ut.usertype'))
						->where('u.id = ?', intval($uid) );
						
				$user = $this->getAdapter()->fetchAll($select);
				return $user[0];
				
			}
		}
		
		public function getBehandelaars(){
			
			$where = $this->getAdapter()->quoteInto( 'userType = ?', 3 );
			$rBehandelaars = $this->fetchAll($where);
			
			//juiste waarde terug geven in de vorm van een array("id" => username)
			foreach($rBehandelaars as $behandelaar){
				$aBehandelaars[$behandelaar["id"]] = $behandelaar['username'];
			}
			
			return $aBehandelaars;
		}
}

